from django.urls import re_path

from lab.user.auth.mini_views import WechatLoginViewSet, WechatLoginWithPhoneNumberViewSet, \
    WechatLoginWithPhoneNumberAndVerificationCodeViewSet
from lab.user.auth.offical_account_view import OfficialAccountLoginWithPhoneNumberViewSet, \
    OfficialAccountLoginViewSet
from lab.user.auth.sms_views import MobileLoginViewSet, SmsViewSet
from lab.user.auth.wechat_qr_views import WechatQrScanLoginViewSet, WechatQrScanLoginWithPhoneNumberViewSet
from lab.user.views import LogoutViewSet, UserViewSet, TokenRefreshViewSet, LoginViewSet, UserSearchViewSet

urlpatterns = [
    re_path(r'^auth/mini/login/f/mobile$', WechatLoginWithPhoneNumberAndVerificationCodeViewSet.as_view({'post': 'create'}),
            name='用户微信第一次登录用手机号码及验证码'),
    re_path(r'^auth/mini/login/f$', WechatLoginWithPhoneNumberViewSet.as_view({'post': 'create'}),
            name='用户微信第一次登录'),
    re_path(r'^auth/mini/login$', WechatLoginViewSet.as_view({'post': 'create'}), name='用户微信登录'),
    re_path(r'^auth/mobile/login$', MobileLoginViewSet.as_view({'post': 'create'}), name='用户手机登录'),
    re_path(r'^auth/qr/login/f$', WechatQrScanLoginWithPhoneNumberViewSet.as_view({'post': 'create'}),
            name='用户手机扫码登录'),
    re_path(r'^auth/qr/login$', WechatQrScanLoginViewSet.as_view({'post': 'create'}), name='用户手机扫码登录'),
    re_path(r'^auth/oa/login/f$', OfficialAccountLoginWithPhoneNumberViewSet.as_view({'post': 'create'}), name='用户公众号第一次登录'),
    re_path(r'^auth/oa/login$', OfficialAccountLoginViewSet.as_view({'post': 'create'}), name='用户公众号登录'),
    re_path(r'^auth/logout$', LogoutViewSet.as_view({'get': 'retrieve'}), name='用户注销登录'),
    re_path(r'^user$', UserViewSet.as_view({'get': 'retrieve', 'put': 'update'}), name='用户信息'),
    re_path(r'^user/search/(?P<keyword>.+)$', UserSearchViewSet.as_view({'get': 'retrieve'}), name='搜索用户'),
    re_path(r'^token/refresh$', TokenRefreshViewSet.as_view({'get': 'retrieve'}), name='用户token刷新'),
    re_path(r'^token$', LoginViewSet.as_view({'get': 'retrieve'}), name='用户登录'),
    re_path(r'^sms$', SmsViewSet.as_view({'post': 'create'}), name='获取手机验证码'),

    # re_path(r'^users', UserViewSet.as_view({'get': 'list', 'post': 'create'}), name='用户信息'),
]
